<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	ArrayList<String> jsPaths = (ArrayList<String>) request
			.getAttribute("jsPaths");
	jsPaths.add("/resources/bootstrap/table/jquery.dataTables.min.js");
	jsPaths.add("/resources/bootstrap/table/dataTables.bootstrap.js");
	jsPaths.add("/resources/bootstrap/dist/js/typeahead.js");
	jsPaths.add("/resources/custom/configuration/configuration.js");
	jsPaths.add("/resources/bootstrap/dist/js/fileInput.js");
%>

<link
	href="${pageContext.request.contextPath}/resources/bootstrap/table/dataTables.bootstrap.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath}/resources/bootstrap/dist/css/typeaheadjs.css"
	rel="stylesheet">

<script type="text/javascript">
	var errorMsg = "${error}";
</script>
<div id="alert-warning"
	class="alert alert-warning alert-dismissable hidden">
	<button type="button" class="close" data-dismiss="alert"
		aria-hidden="true">&times;</button>
</div>

<div class="row">
	<h2 class="sub-header">Configuration List</h2>
</div>
<form role="form">
	<div class="row">
		<div class="col-sm-4 form-group">
			<div class="col-sm-4">
				<label for="searchFc" class="control-label">FC:</label>
			</div>
			<div class="col-sm-8">
				<input name="searchFc" id="searchFc" placeholder="FC"
					class="form-control">
			</div>

		</div>
		<div class="col-sm-4 form-group">
			<div class="col-sm-4">
				<label for="searchShipMethod" class="control-label">ShipMethod:</label>
			</div>
			<div class="col-sm-8">
				<input name="searchShipMethod" id="searchShipMethod"
					placeholder="ShipMethod" class="form-control">
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-sm-4 form-group">
			<div class="col-sm-4">
				<label for="searchProvince" class="control-label">Province:</label>
			</div>
			<div class="col-sm-8">
				<input name="searchProvince" id="searchProvince"
					placeholder="province" class="form-control">
			</div>
		</div>


		<div class="col-sm-4 form-group">
			<div class="col-sm-4">
				<label for="searchCity" class="control-label">City:</label>
			</div>
			<div class="col-sm-8">
				<input name="searchCity" id="searchCity" placeholder="city"
					class="form-control">
			</div>
		</div>
		<div class="col-sm-4 form-group">
			<div class="col-sm-4">
				<label for="searchDistrict" class="control-label">District:</label>
			</div>
			<div class="col-sm-8">
				<input name="searchDistrict" id="searchDistrict"
					placeholder="district" class="form-control">
			</div>
		</div>
	</div>
</form>
<div class='row'>
	<!--  <button class="btn btn-success btn-sm" data-toggle="modal"
		data-target="#createConfigModal" id="addConfig">Add</button>-->
	<button class="btn btn-success btn-sm" data-toggle="modal"
		data-target="#shipmentsModal" id="uploadShipments">Upload
		Shipments</button>

	<button class="btn btn-success btn-sm" data-toggle="modal"
		data-target="#ttModal" id="uploadTt">Upload TransitTime</button>
</div>

<div class="row">
	<div class="table-responsive">
		<table class="table table-striped" id="config">
			<thead>
				<tr>
					<th>FC</th>
					<th>ShipMethod</th>
					<th>Province</th>
					<th>City</th>
					<th>District</th>
					<th>TT</th>
					<th>Shipments</th>
					<!-- <th>Options</th> -->
				</tr>
			</thead>
			<tbody>
			</tbody>
		</table>
	</div>
</div>

<!-- add configuration dialog -->
<div class="modal fade" id="createConfigModal" tabindex="-1"
	role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">Configuration</h4>
			</div>

			<form id="addForm" class="form-horizontal" role="form"
				action="${pageContext.request.contextPath}/configuration/create"
				method="post">
				<div class="modal-body">
					<div class="form-group">
						<label for="fc" class="col-sm-3 control-label">FC</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="fc" name="fc"
								placeholder="FC">
						</div>
					</div>
					<div class="form-group">
						<label for="shipMethod" class="col-sm-3 control-label">ShipMethod</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="shipMethod"
								name="shipMethod" placeholder="ShipMethod">
						</div>
					</div>
					<div class="form-group">
						<label for="Province" class="col-sm-3 control-label">Province</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="province"
								name="province" placeholder="Province">
						</div>
					</div>
					<div class="form-group">
						<label for="city" class="col-sm-3 control-label">City</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="city" name="city"
								placeholder="City">
						</div>
					</div>
					<div class="form-group">
						<label for="district" class="col-sm-3 control-label">District</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="district"
								name="district" placeholder="District">
						</div>
					</div>
					<div class="form-group">
						<label for="tt" class="col-sm-3 control-label">Transit
							Time</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="tt" name="tt"
								placeholder="Transit Time">
						</div>
					</div>
					<div class="form-group">
						<label for="shipments" class="col-sm-3 control-label">Shipments</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="shipments"
								name="shipments" placeholder="Shipments">
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					<button type="submit" class="btn btn-primary" id="Create">Create</button>
				</div>
			</form>
		</div>
	</div>
</div>
<!-- edit location dialog -->
<div class="modal fade" id="editConfigModal" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title" id="myModalLabel">Configuration</h4>
			</div>

			<form id="editForm" class="form-horizontal" role="form"
				action="${pageContext.request.contextPath}/configuration/update"
				method="post">
				<div class="modal-body">
					<input type="hidden" id="idEdit" name="id">
					<div class="form-group">
						<label for="fc" class="col-sm-3 control-label">FC</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="fcEdit" name="fc"
								placeholder="FC">
						</div>
					</div>
					<div class="form-group">
						<label for="shipMethod" class="col-sm-3 control-label">ShipMethod</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="shipMethodEdit"
								name="shipMethod" placeholder="ShipMethod">
						</div>
					</div>
					<div class="form-group">
						<label for="provinceEdit" class="col-sm-3 control-label">Province</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="provinceEdit"
								name="province" placeholder="Province">
						</div>
					</div>
					<div class="form-group">
						<label for="city" class="col-sm-3 control-label">City</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="cityEdit" name="city"
								placeholder="City">
						</div>
					</div>
					<div class="form-group">
						<label for="district" class="col-sm-3 control-label">District</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="districtEdit"
								name="district" placeholder="District">
						</div>
					</div>
					<div class="form-group">
						<label for="tt" class="col-sm-3 control-label">Transit
							Time</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="ttEdit" name="tt"
								placeholder="Transit Time">
						</div>
					</div>
					<div class="form-group">
						<label for="shipments" class="col-sm-3 control-label">Shipments</label>
						<div class="col-sm-9">
							<input type="text" class="form-control" id="shipmentsEdit"
								name="shipments" placeholder="Shipments">
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
					<button type="submit" class="btn btn-primary">Save
						Configuration</button>
				</div>
			</form>
		</div>
	</div>
</div>
<!-- delete location dialog -->
<div class="modal fade" id="deleteConfigModal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title">Configuration Delete</h4>
			</div>
			<div class="modal-body">
				<form class="form-horizontal" role="form"
					action="${pageContext.request.contextPath}/configuration/delete"
					method="post">
					<div class="form-group">
						<label for="shipmentsFile" class="col-sm-3 control-label">File
							Name:</label>
						<div class="col-sm-9">
							<input type="file" id="shipmentsFile" name="shipmentsFile">
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Upload</button>
						<button type="submit" class="btn btn-primary">Delete</button>
					</div>
				</form>
			</div>

		</div>

	</div>
</div>

<!-- upload Shipments dialog -->
<div class="modal fade" id="shipmentsModal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title">Upload Shipments</h4>
			</div>
			<div class="modal-body">
				<form class="form-horizontal" role="form"
					action="${pageContext.request.contextPath}/shipments/upload"
					method="post" enctype="multipart/form-data">
					<div class="form-group">
						<label for="shipmentsFile" class="col-sm-3 control-label">File
							Name:</label>
						<div class="col-sm-9">
							<input type="file" id="shipmentsFile" name="file"
								title="Search for a file to add">
						</div>
					</div>

					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
						<button type="submit" class="btn btn-primary">Upload</button>
					</div>
				</form>
			</div>
		</div>

	</div>

</div>

<!-- upload transitTime dialog -->
<div class="modal fade" id="ttModal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title">Upload Transit Time</h4>
			</div>
			<div class="modal-body">
				<form class="form-horizontal" role="form"
					action="${pageContext.request.contextPath}/transittime/upload"
					method="post" enctype="multipart/form-data">
					<div class="form-group">
						<label for="ttFile" class="col-sm-3 control-label">File
							Name:</label>
						<div class="col-sm-9">
							<input type="file" id="ttFile" name="file"
								title="Search for a file to add">
						</div>
					</div>


					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
						<button type="submit" class="btn btn-primary">Upload</button>
					</div>
				</form>
			</div>
		</div>

	</div>

</div>